library itheme;

import 'package:flutter/material.dart';
import 'package:top_foundation/utils/util.dart';

// ignore_for_file: non_constant_identifier_names

part 'text.dart';

enum IAlignment {
  start,
  center,
  end,
}

class ITheme {
  static Color themeColor = const Color(0xff004DB6);
  static Color selectedColor = const Color(0xff004DB6);
  static Color backgroundColor = const Color(0xfff0f2f5);

  static Color contentColor = const Color(0xff999999);
  static Color borderColor = const Color(0xffdcdfe6);
  static Color dividerColor = const Color(0xfff0f2f5);
  static Color focusColor = const Color(0xff004DB6);

  static Color errorColor = Colors.red;
  static Color disableColor = const Color(0xffbbbbbb);
  static Color disableBgColor = const Color(0xffdedede);
  static Color titleColor = const Color(0xff333333);
  static Color subtitleColor = const Color(0xff666666);

  static Color hintColor = const Color(0xff666666);

  static BorderSide borderSide = BorderSide(color: borderColor, width: 0.5);
  static BorderRadius circleBorderRadius4 = BorderRadius.circular(4);

  static Divider divider = Divider(
    height: 0.5,
    color: dividerColor,
  );

  static void register() {
    buttonTheme = ButtonThemeData(
        textTheme: ButtonTextTheme.normal,
        minWidth: 100.r,
        height: 40.r,
        buttonColor: selectedColor,
        colorScheme: ColorScheme.light(
          background: selectedColor,
          primary: Colors.white,
        ));
    text = ITextTheme(
      displayLarge: TextStyle(color: contentColor, fontSize: 17.sp),
      displayMedium: TextStyle(color: contentColor, fontSize: 15.sp),
      displaySmall: TextStyle(color: contentColor, fontSize: 13.sp),
      headlineLarge: TextStyle(
          color: titleColor, fontSize: 20.sp, fontWeight: FontWeight.bold),
      headlineMedium: TextStyle(
          color: titleColor, fontSize: 17.sp, fontWeight: FontWeight.bold),
      headlineSmall: TextStyle(
          color: titleColor, fontSize: 15.sp, fontWeight: FontWeight.bold),
      titleLarge: TextStyle(color: titleColor, fontSize: 17.sp),
      titleMedium: TextStyle(color: titleColor, fontSize: 15.sp),
      titleSmall: TextStyle(color: titleColor, fontSize: 13.sp),
      labelLarge: TextStyle(color: subtitleColor, fontSize: 14.sp),
      labelMedium: TextStyle(color: subtitleColor, fontSize: 12.sp),
      labelSmall: TextStyle(color: subtitleColor, fontSize: 11.sp),
    );

    theme = ThemeData(
        scaffoldBackgroundColor: backgroundColor,
        inputDecorationTheme: InputDecorationTheme(
          hintStyle: TextStyle(color: ITheme.hintColor, fontSize: 15),
          border: InputBorder.none,
          enabledBorder: InputBorder.none,
          focusedBorder: InputBorder.none,
        ),
        appBarTheme: AppBarTheme(
          foregroundColor: titleColor,
          backgroundColor: Colors.white,
          surfaceTintColor: themeColor,
        ),
        textButtonTheme: TextButtonThemeData(
          style: ButtonStyle(
            textStyle: MaterialStatePropertyAll(
              TextStyle(color: ITheme.titleColor, fontSize: 15),
            ),
            foregroundColor: MaterialStatePropertyAll(titleColor),
            minimumSize: MaterialStateProperty.all(Size(50, 40)),
          ),
        ),
        cardTheme: const CardTheme(
          color: Colors.white,
          surfaceTintColor: Colors.white,
        ),
        disabledColor: disableColor,
        colorScheme: ColorScheme.light(
          background: Colors.white,
          primary: selectedColor,
          // primary: Colors.red,
        ),
        dividerTheme: DividerThemeData(
          color: dividerColor,
          thickness: 0.5,
        ),
        textTheme: text);
  }

  static ButtonThemeData buttonTheme = ButtonThemeData(
      textTheme: ButtonTextTheme.normal,
      minWidth: 100.r,
      height: 40.r,
      buttonColor: selectedColor,
      colorScheme: ColorScheme.light(
        background: selectedColor,
        primary: Colors.white,
      ));

  static ITextTheme text = ITextTheme(
    displayLarge: TextStyle(color: contentColor, fontSize: 17.sp),
    displayMedium: TextStyle(color: contentColor, fontSize: 15.sp),
    displaySmall: TextStyle(color: contentColor, fontSize: 13.sp),
    headlineLarge: TextStyle(
        color: titleColor, fontSize: 20.sp, fontWeight: FontWeight.bold),
    headlineMedium: TextStyle(
        color: titleColor, fontSize: 17.sp, fontWeight: FontWeight.bold),
    headlineSmall: TextStyle(
        color: titleColor, fontSize: 15.sp, fontWeight: FontWeight.bold),
    titleLarge: TextStyle(color: titleColor, fontSize: 17.sp),
    titleMedium: TextStyle(color: titleColor, fontSize: 15.sp),
    titleSmall: TextStyle(color: titleColor, fontSize: 13.sp),
    labelLarge: TextStyle(color: subtitleColor, fontSize: 14.sp),
    labelMedium: TextStyle(color: subtitleColor, fontSize: 12.sp),
    labelSmall: TextStyle(color: subtitleColor, fontSize: 11.sp),
  );

  static ThemeData theme = ThemeData(
      scaffoldBackgroundColor: backgroundColor,
      inputDecorationTheme: InputDecorationTheme(
        hintStyle: TextStyle(color: ITheme.hintColor, fontSize: 15),
        border: InputBorder.none,
        enabledBorder: InputBorder.none,
        focusedBorder: InputBorder.none,
      ),
      appBarTheme: AppBarTheme(
        foregroundColor: titleColor,
        backgroundColor: Colors.white,
        surfaceTintColor: themeColor,
      ),
      textButtonTheme: TextButtonThemeData(
        style: ButtonStyle(
          textStyle: MaterialStatePropertyAll(
            TextStyle(color: ITheme.titleColor, fontSize: 15),
          ),
          foregroundColor: MaterialStatePropertyAll(titleColor),
          minimumSize: MaterialStateProperty.all(Size(50, 40)),
        ),
      ),
      cardTheme: const CardTheme(
        color: Colors.white,
        surfaceTintColor: Colors.white,
      ),
      disabledColor: disableColor,
      colorScheme: ColorScheme.light(
        background: Colors.white,
        primary: selectedColor,
        // primary: Colors.red,
      ),
      dividerTheme: DividerThemeData(
        color: dividerColor,
        thickness: 0.5,
      ),
      textTheme: text);
}
